package com.ruoyi.flow.auth.security;

import org.activiti.engine.identity.User;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Objects;

/**
 * @Author: wtian
 * @Description:
 * @Date: Created in 9:49 2018/8/10
 * @Version: 1.0
 */
public class FlowUser extends org.springframework.security.core.userdetails.User {
    private User user;

    public FlowUser(User user, Collection<? extends GrantedAuthority> authorities) {
        super(user.getId(), user.getPassword(), authorities);
        this.user = user;
    }

    public User getUser() {
        return user;
    }

    public String getName() {
        return Objects.toString(user.getFirstName(), "") + Objects.toString(user.getLastName(), "");
    }
}
